let strings = [];
let colors = [];
let idsMap = {};

function genStringXml(content) {
    key = content.replace(/[\,\n、\.]/g, '');

    // 是否全数字
    if (/^\d+$/.test(key)) {
        return {
            arb: ``,
            ref: `"${key}"`
        };
    }

    // 将字符串按空格分割为单词数组
    const words = key.split(' ');

    // 只取前五个单词
    let truncatedWords = words.slice(0, 5);
    // 清除数字
    truncatedWords = truncatedWords.filter(word => !/\d/.test(word));

    // 将单词数组转换为小驼峰字符串
    let camelCase = truncatedWords.map((word, index) => {
        // 如果不是第一个单词，则转换为驼峰
        if (index !== 0) {
            return word.charAt(0).toUpperCase() + word.slice(1);
        }
        // 如果是第一个单词，则转换为小驼峰
        return word.charAt(0).toLowerCase() + word.slice(1);
    }).join('');
    camelCase = camelCase.replace('\'', '');

    let res = {
        xml: camelCase == '' ? null : `<string name="${camelCase}">${content}</string>`,
        ref: camelCase.length > 0 ? `@string/${camelCase}` : null
    };
    strings.push(res.xml);
    return res
}